#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

#include "logger.h"

#define THREADS_NUM 3

void *print_logs(void *data) {
	LOG_DEBUG("Testing logger :)");
	LOG_INFO("Testing logger(1) %)");
	LOG_WARNING("Tesing logger(2) ^^");
	LOG_EMERG("Testing logger(3) :P");
	return NULL;
}

int main(int argc, char *argv[]) {
	int i;
	log_init(WARNING, argv[1]);
	pthread_t *pthr = (pthread_t *)malloc(sizeof(pthread_t) * THREADS_NUM);

	for (i = 0; i < THREADS_NUM; ++i)
		pthread_create(&pthr[i], NULL, print_logs, NULL);

	for (i = 0; i < THREADS_NUM; ++i)
		pthread_join(pthr[i], NULL);
	pthread_join(logg.tid, NULL);

	free(pthr);
	log_deinit();
}
